#include <glib.h>

int main (int argc, char** argv)
{
    GRegex* regex;
    GMatchInfo *match_info;
    GError *error = NULL;
    const gchar *str = "the name of the frog is themselves";
    const gchar *pat = "\\bthe\\b";

    regex = g_regex_new(pat, 0, 0, &error);
    g_regex_match(regex, str, 0, &match_info);

    while (g_match_info_matches(match_info)) {
        gchar* word = g_match_info_fetch(match_info, 0);
        g_print("%s \n",word);
        g_free(word);

        g_match_info_next(match_info, NULL);
    }

    g_match_info_free(match_info);
    g_regex_unref(regex);

  return 0;
}